#ifndef DEVICE_WINDOW_MANAGER_X11
#define DEVICE_WINDOW_MANAGER_X11

    #include "../device.h"
    #include "../../../define.h"
    #if defined x11_device_support

    #include <stdio.h>
    #include <stdlib.h>
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    #include <X11/Xos.h>
    #include <X11/Xatom.h>
    #include <X11/keysym.h>
    #include <GL/glx.h>
    #include <fcntl.h>
    #include <unistd.h>
    #include <sys/utsname.h>

    namespace sleek
    {
        namespace core
        {
            namespace device
            {
                class Device_x11 : public Device
                {
                    public:
                        Device_x11(Device_stub);
                        virtual ~Device_x11();

                        virtual bool run();
                        virtual void begin(texture::pixel);
                        virtual void end();

                        virtual void setGamma(texture::pixel);
                        virtual void setCaption(os::stringc);
                        virtual void setVideoSize(math::vector2du);
                        virtual void setWindowPos(math::vector2di);
                        virtual void setFullScreen(bool);

                        virtual void enableWindowDecorator(bool);

                        virtual void makeRenderContext(GL_RENDER_CONTEXT);
                        virtual void destroyRenderContext(GL_RENDER_CONTEXT);
                        virtual void switchToRenderContext(GL_RENDER_CONTEXT);
                        virtual core::math::vector2du getDesktopVideoSize();

                        virtual void WarpMouse(math::vector2di);
                        virtual void ShowMouse(bool);
                    protected:
                        Device_x11(){}

                        Window      window;
                        Display     *display;
                        XVisualInfo *vi;
                        XEvent       xev;
                        XSetWindowAttributes swa;
                        GLXContext   cx[5];
                        virtual void initOpenCL();
                    private:
                        Cursor invisCursor;
                        void CreateX11Cursor();
                        void keymap(XEvent,input*);
                        friend Device* CreateDeviceWindowManager(DeviceWindowManager, Device_stub);
                };
            }
        }
    }

    #endif
#endif
